package com.example.demo.zookeeper;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

public class psvm {
    public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
        // 链接zk
        ZooKeeper zooKeeper = new ZooKeeper("172.20.52.22:1218", 3000, (watchedEvent) -> {});
        System.out.println(zooKeeper);
        // 创建一个持久化节点
        System.out.println(zooKeeper.create("/test1", "aa.txt".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
    }
}
